package cn.itsource.romate.fallback;

import cn.itsource.pojo.api.AddLogin;
import cn.itsource.result.R;
import cn.itsource.romate.api.LoginApi;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 📖：beishan
 * 🗓️：2024/3/29 11:19
 * =====================
 * feign的降级类
 */
@Component
public class LoginFallback implements FallbackFactory<LoginApi> {
    @Override
    public LoginApi create(Throwable cause) {

        return new LoginApi() {
            @Override
            public R addLogin(AddLogin addLogin) {
                cause.printStackTrace();
                return R.error("微信注册失败");
            }

            @Override
            public R updLogin(Long id, String name) {
                return R.error("出错了");
            }


        };
    }
}
